import 'package:demo_flutter/library.dart';

import 'action.dart';
import 'state.dart';

Widget buildView(IndexState state, Dispatch dispatch, ViewService viewService) {
  return Scaffold(
    body: Container(
      alignment: Alignment.topCenter,
      child: Column(
        mainAxisAlignment: MainAxisAlignment.spaceAround,
        crossAxisAlignment: CrossAxisAlignment.center,
        children: List.from(state.btnList.map((item){
          return RaisedButton(
            child: Text('${item.name}'),
            onPressed: ()async{
              await Navigator.pushNamed(viewService.context, item.toPageByName, arguments: item.params);
            },
          );
        })),
      ),
    ),
  );
}
